﻿@page "/HYJ_Single_Table_CRUD"
@using BBCore.Core.Models.Samples
@using BBCore.Application.Interface
@using BBCore.Server.PublicComponentBase
@using BBCore.Core.Models.EnumTypes
@inherits Single_Table_ComponentBase
@inject IDataQueryService<HYJ_Single_Table> IDataQueryService
<Table TItem="HYJ_Single_Table" @ref="_table"
       IsBordered="true" IsStriped="true" IsPagination="true" PageItemsSource="new int[] { 10, 20,100}"
       ShowEmpty="true" EmptyText="暂无数据" EmptyImage="images/empty.svg"
       ShowSkeleton="true" ShowLoading="true" ShowSearch="true" ClickToSelect="true"
       OnQueryAsync="@OnQueryAsync" OnDeleteAsync="@OnDeleteAsync" OnSaveAsync="@OnSaveAsync"
       ShowAddButton="@AuthorizeButton(ButtonPermissionTypeEnum.Add)"
       ShowEditButton="@AuthorizeButton(ButtonPermissionTypeEnum.Edit)"
       ShowDeleteButton="@AuthorizeButton(ButtonPermissionTypeEnum.Del)"
       ShowExtendEditButton="@AuthorizeButton(ButtonPermissionTypeEnum.Edit)"
       ShowExtendDeleteButton="@AuthorizeButton(ButtonPermissionTypeEnum.Del)"
       ShowToolbar="true" ShowExtendButtons="true"
       ShowExportButton="true">
    <TableToolbarTemplate>
        <TableToolbarButton Color="Color.Primary" Text="模板下载" Icon="fas fa-download" IsShow="@AuthorizeButton(ButtonPermissionTypeEnum.Template)" OnClick="tempDownload"></TableToolbarButton>
        @if (AuthorizeButton(ButtonPermissionTypeEnum.Import))
        {
            <TableToolbarComponent TItem="HYJ_Single_Table">
                <ButtonUpload TValue="string" ShowUploadFileList="false" BrowserButtonClass="btn-secondary"
                              Accept=".xlsx, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" BrowserButtonText="导入" OnChange="DataImport"></ButtonUpload>
            </TableToolbarComponent>
        }
    </TableToolbarTemplate>
    <TableColumns>
        <TableColumn @bind-Field="@context.Name" Searchable="true"></TableColumn>
        <TableColumn @bind-Field="@context.Price"></TableColumn>
        <TableColumn @bind-Field="@context.Date"></TableColumn>
    </TableColumns>
</Table>
